import request from "@/utils/request";

export function pageList(params) {
  return request({
    url: "/resource/config/pageList",
    method: "post",
    data: params
  });
}

export function getObject(id) {
  return request({
    url: "/resource/config/" + id,
    method: "get"
  });
}

export function addObject(params) {
  return request({
    url: "/resource/config/add",
    method: "post",
    data: params
  });
}

export function updateObject(id, params) {
  return request({
    url: "/resource/config/update/" + id,
    method: "post",
    data: params
  });
}

export function deleteById(params) {
  return request({
    url: "/resource/config/delete",
    method: "post",
    params: params
  });
}

export function downloadTemplate(params) {
  return request({
    url: "/resource/config/downloadTemplate",
    method: "get",
    params: params,
    responseType: "blob"
  });
}

export function importData(params) {
  return request({
    url: "/resource/config/importData",
    method: "post",
    data: params
  });
}

export function importToFile(params) {
  return request({
    url: "/resource/config/importToFile",
    method: "post",
    data: params,
    headers: {
      "Content-Type": "multipart/form-data"
    }
  });
}
